package morning.cat.study.quartz.job;

import morning.cat.study.quartz.util.DateUtil;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
import org.quartz.TriggerKey;

public class MyJobTask2 implements Job {

	private String hit;

	public String getHit() {
		return hit;
	}

	public void setHit(String hit) {
		this.hit = hit;
	}

	@Override
	public void execute(JobExecutionContext jobExecutionContext)
			throws JobExecutionException {
		DateUtil.printNowForString("MyJobTask.execute ");
		System.out.println("run Job");

		JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
		System.out.println("lover = " + jobDataMap.getString("lover"));
		System.out.println("bir = " + jobDataMap.getInt("bir"));
		System.out.println("msg = " + jobDataMap.getString("msg"));
		
		System.out.println("设置注入 = " + jobDataMap.getString("hit"));

		JobKey jobKey = jobExecutionContext.getJobDetail().getKey();
		System.out.println("JobDetail's name : " + jobKey.getName());
		System.out.println("JobDetail's group : " + jobKey.getGroup());

		TriggerKey triggerKey = jobExecutionContext.getTrigger().getKey();
		System.out.println("TriggerKey's name : " + triggerKey.getName());
		System.out.println("TriggerKey's group : " + triggerKey.getGroup());
	}

}
